/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.blitscreen.camera
{
	import com.bourre.events.BasicEvent;
	
	import flash.geom.Rectangle;

	/**
	 * Event object dispatched by the <code>Camera</code> class
	 * when one its screen's properties have changed.
	 * 
	 * @author Cédric Néhémie
	 * @see com.blitscreen.camera.Camera
	 * @see com.blitscreen.camera.CameraListener
	 */
	public class CameraEvent extends BasicEvent
	{
		/**
		 * Name of the event type the <code>Camera</code> dispatch.
		 */
		static public const onCameraChangeEVENT : String = "onCameraChange";
		
		/**
		 * Creates a new <code>CameraEvent</code> for the passed-in event.
		 * 
		 * @param type		<code>String</code> containing the name of the event
		 * @param source	<code>Camera</code> object that have dispatched the event
		 */
		public function CameraEvent( type : String, source : Object = null )
		{
			super(type, source);
		}
		
		/**
		 * Returns the <code>Camera</code> object that have dispatched the
		 * current event object.
		 * 
		 * @return <code>Camera</code> object that have dispatched the
		 * current event object
		 */
		public function getCamera () : Camera
		{
			return target as Camera;
		}
		
		/**
		 * Returns the current screen represented by the current 
		 * <code>Camera</code> object.
		 * 
		 * @return <code>Rectangle</code> of the current screen
		 */
		public function getScreen () : Rectangle
		{
			return getCamera().getScreen();
		}
		
		/**
		 * Returns the current zoom value for the current camera.
		 * 
		 * @return <code>Number</code> zoom value for the current camera
		 */
		public function getZoom() : Number
		{
			return getCamera().getZoom();
		}
	}
}